home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / TIFF_WIN / DO_MOUSE.C < prev    next >
C/C++ Source or Header  |  1990-04-10  |  2KB  |  59 lines

  1. #include "my color.h"
  2.  
  3. void do_mouse_down(the_event)    /* This routine is called for every mouse down event */
  4. EventRecord    *the_event;            
  5. {
  6. CWindowPtr    whichWindow;
  7. long        grow_window_result;
  8. ControlHandle    control;
  9. CGrafPtr    the_tiff_picture;
  10.  
  11.     switch (FindWindow(the_event->where,&whichWindow))    
  12.     {
  13.  
  14.         case inSysWindow:
  15.             SystemClick(&the_event,whichWindow);
  16.             break;
  17.         case inMenuBar:
  18.             DoCommand(MenuSelect(&the_event->where));
  19.             break;
  20.         case inDrag:
  21.             DragWindow(whichWindow,the_event->where,&dragRect);                                    
  22.             break;
  23.         case inContent:
  24.                 if (whichWindow != (CWindowPtr)FrontWindow())
  25.                     SelectWindow(whichWindow);
  26.                 else if(!do_controls(whichWindow, the_event->where))
  27.                 {     
  28.                     GlobalToLocal(&the_event->where);
  29.                     extendedCH = ((the_event->modifiers & shiftKey) != 0);
  30.                 } /*else*/
  31.             break;
  32.         case inGoAway:
  33.             if (TrackGoAway (whichWindow, &the_event->where))
  34.                 KillWindow (whichWindow);
  35.             break;
  36.         
  37.         case inGrow:
  38.             grow_window_result = GrowWindow(whichWindow,the_event->where, &screenBits.bounds);
  39.             if(grow_window_result)
  40.             {
  41.                 invalidate_controls(whichWindow);
  42.                 SizeWindow(whichWindow, LoWord(grow_window_result), 
  43.                     HiWord(grow_window_result), TRUE);
  44.                 the_tiff_picture = (CGrafPtr)(*(CWindowPeek)whichWindow).refCon;
  45.                 if(the_tiff_picture)
  46.                 {
  47.                     (*the_tiff_picture).portRect.bottom = (*the_tiff_picture).portRect.top + (whichWindow->portRect.bottom - whichWindow->portRect.top) - BAR_WIDTH;
  48.                     (*the_tiff_picture).portRect.right = (*the_tiff_picture).portRect.left + (whichWindow->portRect.right - whichWindow->portRect.left) - BAR_WIDTH;    
  49.                     if(    (*the_tiff_picture).portRect.bottom > (**(*the_tiff_picture).portPixMap).bounds.bottom)
  50.                         (*the_tiff_picture).portRect.bottom = (**(*the_tiff_picture).portPixMap).bounds.bottom;        
  51.                     if(    (*the_tiff_picture).portRect.right > (**(*the_tiff_picture).portPixMap).bounds.right)
  52.                         (*the_tiff_picture).portRect.right = (**(*the_tiff_picture).portPixMap).bounds.right;        
  53.                 }
  54.                 adjust_scroll_bars(whichWindow);
  55.             }
  56.             break;
  57.  
  58.     }    /*switch FindWindow*/
  59. }